<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://localhost/RestEasyHotel/css/styles.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="http://localhost/RestEasyHotel/css/jquery-ui-1.8.14.custom.css" type="text/css" media="screen, projection">
<script src="http://localhost/RestEasyHotel/js/jquery-1.6.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://localhost/RestEasyHotel/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
   $(document).ready(function(){
		$('#check-in').click(function(){
			$.ajax({
				url: "<?php echo base_url(); ?>index.php/staff/check_in",
				type: 'post',
				data: {'reserve_id': $("input[name='customer1']:checked").val()},
				success: function(data){
					window.location.reload();
				}
			});
		});
		$('#check-out').click(function(){
			$.ajax({
				url: "<?php echo base_url(); ?>index.php/staff/check_out",
				type: 'post',
				data: {'reserve_id': $("input[name='customer2']:checked").val()},
				success: function(data){
					window.location.reload();
				}
			});
		});

   });
</script>
</head>
<body>
    <div class="outer">
        <div class="menu">
            <ul>
                <li><a href="<?php echo base_url();?>index.php/staff/reservation_list">Reservation List</a></li>
                <li><a href="<?php echo base_url();?>index.php/staff/checkin_list">Check-In List</a></li>
            </ul>
        </div>
        <div style="float:right; width:900px; padding-top:20px;">
            <div>
                <?php if($page=="reserve"): ?>
                <form action="<?php echo base_url(); ?>index.php/staff/search_reservation" method="post">
                <input type="text" id="search" name="search" style="padding-top:5px; padding-bottom:5px;" /> <input type="submit" id="search_button" value="SEARCH" />
                </form>
                <?php elseif($page=="checkin"): ?>
                <form action="<?php echo base_url(); ?>index.php/staff/search_checkin" method="post">
                <input type="text" id="search" name="search" style="padding-top:5px; padding-bottom:5px;"/> <input type="submit" id="search_button" value="SEARCH" />
                </form>
                <?php endif; ?>
            </div>
            <?php if($list!="NONE" && $list!=NULL && $page=="reserve"): ?>
            <table border="1" style="margin-left:35px; margin-top:40px">
                <tr>
                    <td></td>
                    <td width="180"><div align="center"><strong>Firstname</strong></div></td>
                    <td width="180"><div align="center"><strong>Lastname</span></strong></div></td>
                    <td width="180"><div align="center"><strong>No. of Room</strong></div></td>
                    <td width="180"><div align="center"><strong>Check-In Date</strong></div></td>
                    <td width="180"><div align="center"><strong>Check-Out Date</strong></div></td>
                </tr>
                <?php foreach($list as $l): ?>
                <tr>
                    <td><div align="center"><input type="radio" name="customer1" value="<?php echo $l->reserve_id; ?>" /></div></td>
                    <td><div align="center"><?php echo $l->firstname; ?></div></td>
                    <td><div align="center"><?php echo $l->lastname; ?></div></td>
                    <td><div align="center"><?php echo $l->no_of_room; ?></div></td>
                    <td><div align="center"><?php echo $l->check_in_date; ?></div></td>
                    <td><div align="center"><?php echo $l->check_out_date; ?></div></td>
                </tr>
                <?php endforeach; ?>
            </table>
            <div style="padding-top:20px; float:right;"><img src="http://localhost/RestEasyHotel/images/check_in.png" id="check-in" / ></div>
            <?php elseif($list!="NONE" && $list!=NULL && $page=="checkin"): ?>
            <table border="1" style="margin-left:35px; margin-top:40px">
                <tr>
                    <td></td>
                    <td width="180"><div align="center"><strong>Firstname</strong></div></td>
                    <td width="180"><div align="center"><strong>Lastname</span></strong></div></td>
                    <td width="180"><div align="center"><strong>No. of Room</strong></div></td>
                    <td width="180"><div align="center"><strong>Check-In Date</strong></div></td>
                    <td width="180"><div align="center"><strong>Check-Out Date</strong></div></td>
                </tr>
                <?php foreach($list as $l): ?>
                <tr>
                    <td><div align="center"><input type="radio" name="customer2" value="<?php echo $l->reserve_id; ?>" /></div></td>
                    <td><div align="center"><?php echo $l->firstname; ?></div></td>
                    <td><div align="center"><?php echo $l->lastname; ?></div></td>
                    <td><div align="center"><?php echo $l->no_of_room; ?></div></td>
                    <td><div align="center"><?php echo $l->check_in_date; ?></div></td>
                    <td><div align="center"><?php echo $l->check_out_date; ?></div></td>
                </tr>
                <?php endforeach; ?>
            </table>
            <div style="padding-top:20px; float:right;"><img src="http://localhost/RestEasyHotel/images/check_out.png" id="check-out" / ></div>
            <?php elseif($list=="NONE"): ?>
            No Match!!
            <?php endif; ?>
    	</div>
    </div>
</body>
</html>